<!-- Sofija Puric 6/08 -->
<div class="admin-hostels">
    <div class="admin-title">
        <h2>Feedbacks</h2>
    </div>

    <?php
    function dbConnect($db="") {
    $dbcon = mysql_connect("localhost", "sibuser", "sib011")
        or die('Could not connect: ' . mysql_error());
    if ($db != "" and !mysql_select_db($db, $dbcon))
        die('Could not select database: ' . mysql_error());
    return $dbcon;
}
    $con=dbConnect("sib");
    $hid=$_GET["hid"];    // za hostel_id izlistavamo sve feedback-ove iz baze
    ?>
    <div class="admin-content">
        <table border="0" align="center">
           <thead>
                <tr>
                    <th>Feedback ID</th>
                    <th>DateTime</th>
                    <th>Text</th>
                    <th>Delete</th>
                </tr>

            </thead>
            <tbody>
                <?php
                $sql = "SELECT * FROM feedback WHERE IDHostel = '$hid'";
                $result = mysql_query($sql, $con);
                if (!$result)
                    die('Error: ' . mysql_error());
                while ( $row = mysql_fetch_array($result) ) {
                    echo '
                        <tr>
                            <td>' . $row["IDFeedback"] . '</td>
                            <td>' . $row["DateTime"] . '
                            <td>' . $row["Text"] . '
                            <td><a href = "feedback-d.php?fid='.$row["IDFeedback"].'&hid='.$hid.'">Delete</a></td>
                        </tr>   ';
                }
                mysql_close($con);
                ?>
            </tbody>
        </table>
    </div>
</div>



